package org.jsola.hr.web;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.jsola.core.Page;
import org.jsola.core.Result;
import org.jsola.hr.dto.*;
import org.jsola.hr.query.EmpSocPlanQuery;
import org.jsola.hr.query.IncreaseDecreaseQuery;
import org.jsola.hr.vo.*;
import org.springframework.core.io.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import java.util.List;

/**
 * 增减员计划表
 *
 * @author zhr
 */
@Api(tags = "hr-增减员计划表")
public interface IEmpSocPlanControllerAPI {

    /**
     * 新增增减员计划表
     *
     * @param empSocPlanAddDTO 增减员计划表新增实体
     * @return 增减员计划表展示对象
     */
    @ApiOperation(value = "新增增减员计划表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empSocPlanAddDTO", dataType = "EmpSocPlanAddDTO", value = "新增增减员计划表", paramType = "body")
    })
    Result<EmpSocPlanVO> save(EmpSocPlanAddDTO empSocPlanAddDTO);


    /**
     * 修改增减员计划表
     *
     * @param empSocPlanUpdateDTO 增减员计划表
     * @return 更新数量
     */
    @ApiOperation(value = "修改增减员计划表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empSocPlanUpdateDTO", dataType = "EmpSocPlanUpdateDTO", value = "修改增减员计划表", paramType = "body")
    })
    Result<Integer> update(EmpSocPlanUpdateDTO empSocPlanUpdateDTO);


    /**
     * 删除单个增减员计划表，彻底删除
     *
     * @param empSocPlanId 增减员计划表id
     * @return 删除数量
     */
    @ApiOperation(value = "删除单个增减员计划表，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empSocPlanId", dataType = "String", value = "增减员计划表id", paramType = "path")
    })
    Result<Integer> delete(String empSocPlanId);


    /**
     * 批量删除增减员计划表，彻底删除
     *
     * @param empSocPlanIds 增减员计划表id集合
     * @return 删除数量
     */
    @ApiOperation(value = "批量删除增减员计划表，彻底删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empSocPlanIds", dataType = "String[]", value = "增减员计划表id数组", paramType = "body", allowMultiple = true)
    })
    Result<Integer> deleteBatch(String[] empSocPlanIds);


    /**
     * 根据增减员计划表id查询增减员计划表详情
     *
     * @param empSocPlanId 增减员计划表id
     * @return 增减员计划表详情
     */
    @ApiOperation(value = "根据增减员计划表id查询增减员计划表详情")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empSocPlanId", dataType = "String", value = "增减员计划表id", paramType = "path")
    })
    Result<EmpSocPlanVO> findById(String empSocPlanId);


    /**
     * 查询增减员计划表
     *
     * @param empSocPlanQuery 增减员计划表查询参数
     * @return page
     */
    @ApiOperation(value = "查询增减员计划表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empSocPlanQuery", dataType = "EmpSocPlanQuery", value = "增减员计划表查询参数", paramType = "query")
    })
    Result<List<EmpSocPlanListVO>> listAll(EmpSocPlanQuery empSocPlanQuery);


    /**
     * 分页查询增减员计划表
     *
     * @param empSocPlanQuery 增减员计划表查询参数
     * @return page
     */
    @ApiOperation(value = "分页查询增减员计划表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empSocPlanQuery", dataType = "EmpSocPlanQuery", value = "增减员计划表查询参数", paramType = "query")
    })
    Result<Page<EmpSocPlanListVO>> page(EmpSocPlanQuery empSocPlanQuery);

    /**
     * 增员 V2.0
     *
     * @param batchIncreaseDTO 增员参数
     * @return 增员时间
     */
    @ApiOperation(value = "增员 V2.0")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "batchIncreaseDTO", dataType = "EmpSocPlanBatchAddDTO", value = "增员参数", paramType = "body")
    })
    Result<String> increase(EmpSocPlanBatchAddDTO batchIncreaseDTO);

    /**
     * 减员 V2.0
     *
     * @param increaseDecreaseQuery 减员参数
     * @return 减员结果
     */
    @ApiOperation(value = "减员 V2.0")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "increaseDecreaseQuery", dataType = "IncreaseDecreaseQuery", value = "减员参数", paramType = "body")
    })
    Result<List<CheckDecreaseFailVO>> decrease(IncreaseDecreaseQuery increaseDecreaseQuery);

    /**
     * 增减员计划列表 V2.0
     *
     * @param empSocPlanQuery 查询参数
     * @return 人员列表
     */
    @ApiOperation(value = "增减员计划列表 V2.0")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empSocPlanQuery", dataType = "EmpSocPlanQuery", value = "查询参数", paramType = "query")
    })
    Result<Page<EmpSocPlanListVO>> increaseOrDecreaseList(EmpSocPlanQuery empSocPlanQuery);

    /**
     * 增减员计划顶部数量统计
     *
     * @param empSocPlanQuery 查询参数
     * @return 统计结果
     */
    @ApiOperation(value = "增减员计划顶部数量统计")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empSocPlanQuery", dataType = "EmpSocPlanQuery", value = "查询参数", paramType = "query")
    })
    Result<EmpSocTransformCountVO> increaseDecreaseListCount(EmpSocPlanQuery empSocPlanQuery);

    /**
     * 查询一个用工单位下未反馈的增减员计划人数
     *
     * @param companyId 公司Id
     * @return 未反馈的增减员计划人数
     */
    @ApiOperation(value = "查询一个用工单位下未反馈的增减员计划人数")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "companyId", dataType = "String", value = "公司Id", paramType = "path")
    })
    Result<Integer> notFeedbackCount(String companyId);

    /**
     * 校验减员人员
     *
     * @param empIds 员工Id
     * @return 校验结果
     */
    @ApiOperation(value = "校验减员人员")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empIds", dataType = "array", value = "员工Id", paramType = "query")
    })
    Result<List<CheckDecreaseVO>> checkDecrease(List<String> empIds);

    /**
     * 导入增员
     *
     * @param file      导入EXCEL
     * @param companyId 公司Id
     * @return 导入结果
     */
    @ApiOperation(value = "导入增员")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file", dataType = "MultipartFile", value = "导入Excel", paramType = "body"),
            @ApiImplicitParam(name = "companyId", dataType = "String", value = "公司Id", paramType = "query")
    })
    Result<ImportExcelResultListVO<ImportIncreaseDTO>> importIncrease(MultipartFile file, String companyId);

    /**
     * 增员错误数据导出
     *
     * @param errorList 错误数据
     * @return Excel
     */
    @ApiOperation(value = "增员错误数据导出")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "errorList", dataType = "ImportExcelResultListVO", value = "错误列表", paramType = "body")
    })
    ResponseEntity<Resource> exportIncreaseErrorList(ImportExcelResultListVO<ImportIncreaseDTO> errorList);

    /**
     * 导入减员
     *
     * @param file      导入EXCEL
     * @param companyId 公司Id
     * @return 导入结果
     */
    @ApiOperation(value = "导入减员")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "file", dataType = "MultipartFile", value = "导入Excel", paramType = "body"),
            @ApiImplicitParam(name = "companyId", dataType = "String", value = "公司Id", paramType = "query")
    })
    Result<ImportExcelResultListVO<ImportDecreaseDTO>> importDecrease(MultipartFile file, String companyId);

    /**
     * 减员错误数据导出
     *
     * @param errorInfo 错误数据
     * @return Excel
     */
    @ApiOperation(value = "减员错误数据导出")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "errorInfo", dataType = "ImportExcelResultListVO", value = "错误数据", paramType = "body")
    })
    ResponseEntity<Resource> exportDecreaseErrorList(ImportExcelResultListVO<ImportDecreaseDTO> errorInfo);

    /**
     * 查询租户是否开启确认增减员
     *
     * @return 当前用户
     */
    @ApiOperation(value = "减员错误数据导出")
    Result<String> confirmSocBySite();

    /**
     * 取消减员
     *
     * @param planId 计划Id
     * @return 返回结果
     */
    @ApiOperation(value = "取消减员")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "planId", dataType = "String", value = "计划Id", paramType = "path")
    })
    Result<String> cancelDecrease(String planId);

    /**
     * 取消增员
     *
     * @param planId 计划Id
     * @return 返回结果
     */
    @ApiOperation(value = "取消增员")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "planId", dataType = "String", value = "计划Id", paramType = "path")
    })
    Result<String> cancelIncrement(String planId);

    /**
     * 增员(需要确认)
     *
     * @param batchIncreaseDTO 增员参数
     * @return 增员结果
     */
    @ApiOperation(value = "增员(需要确认)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "batchIncreaseDTO", dataType = "EmpSocPlanBatchAddDTO", value = "增员参数", paramType = "body")
    })
    Result<String> increaseExtra(EmpSocPlanBatchAddDTO batchIncreaseDTO);

    /**
     * 增员编辑
     *
     * @param increaseUpdate 编辑参数
     * @return 编辑结果
     */
    @ApiOperation(value = "增员编辑")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "increaseUpdate", dataType = "IncreaseDecreaseUpdateDTO", value = "编辑参数", paramType = "body")
    })
    Result<String> increaseUpdateExtra(IncreaseDecreaseUpdateDTO increaseUpdate);

    /**
     * 增员反馈
     *
     * @param empSocPlanAttachDTO 反馈参数
     * @return 反馈结果
     */
    @ApiOperation(value = "增员反馈")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empSocPlanAttachDTO", dataType = "EmpSocPlanAttachDTO", value = "反馈参数", paramType = "body")
    })
    Result<String> increaseFeedbackExtra(EmpSocPlanAttachDTO empSocPlanAttachDTO);

    /**
     * 减员(需要确认)
     *
     * @param decreaseQuery 减员参数
     * @return 减员结果
     */
    @ApiOperation(value = "减员(需要确认)")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "decreaseQuery", dataType = "IncreaseDecreaseQuery", value = "减员参数", paramType = "body")
    })
    Result<List<CheckDecreaseFailVO>> decreaseExtra(IncreaseDecreaseQuery decreaseQuery);

    /**
     * 减员编辑
     *
     * @param decreaseUpdate 编辑参数
     * @return 编辑结果
     */
    @ApiOperation(value = "减员编辑")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "decreaseUpdate", dataType = "IncreaseDecreaseUpdateDTO", value = "编辑参数", paramType = "body")
    })
    Result<String> decreaseUpdateExtra(IncreaseDecreaseUpdateDTO decreaseUpdate);

    /**
     * 减员反馈
     *
     * @param empSocPlanAttachDTO 反馈参数
     * @return 反馈结果
     */
    @ApiOperation(value = "减员反馈")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "empSocPlanAttachDTO", dataType = "EmpSocPlanAttachDTO", value = "反馈参数", paramType = "body")
    })
    Result<String> decreaseFeedbackExtra(EmpSocPlanAttachDTO empSocPlanAttachDTO);
}

